{include file="public/header"}
<body>
<style>
    .layui-form-label{
        width: 200px;
    }
    .layui-input{
        width:70%;
    }
    .layui-input-block{
        margin-left: 256px;
    }
    legend{
        margin: 2em;
    }
</style>
<fieldset class="layui-elem-field">
    <legend>生成产品激活码</legend>
    <div class="layui-field-box">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 目前拥有激活码 (个)</label>
                <div class="layui-input-block">
                    <input type="text"value="{$total_key}" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 已被激活 (个)</label>
                <div class="layui-input-block">
                    <input type="text" value="{$is_active}" class="layui-input" readonly>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 还需生成激活码数量 (个)</label>
                <div class="layui-input-block">
                    <input type="text" name="quantity" required value="" placeholder="请输入要生成的激活码数量" lay-verify="required" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="admin-form">确认生成</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</fieldset>


{include file="public/footer"}

<script>
    layui.use('form', function(){
        var form = layui.form();
        form.on('submit(admin-form)', function(data){
            var params  = {
                url: '{:url("build_key")}',
                data: data.field,
                type: 'post',
                sCallback:function(res){
                    dialog.confirm(res.msg, '{:url("build_key")}');
                }
            };
            common.request(params);
            return false;
        });

    });
</script>
</body>
</html>